import { useStore } from '@/store'
//比较用户是否有权限
export function usePermission(pageName: string, hanldeName: string) {
  const store = useStore()
  const permissions = store.state.loginModule.permissions
  const verifyPermission = `system:${pageName}:${hanldeName}`

  // name = "coderwhy"  有值 取反就是false
  // !name -> false
  // !!name -> true
  return !!permissions.find((item) => item === verifyPermission)
  // return Boolean(permissions.find((item) => item === verifyPermission))
}
